package com.cis.education.service.impl;

import java.util.List;

import com.cis.education.domain.EduStudent;
import com.cis.education.mapper.EduStudentMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.cis.education.mapper.EduCheckinStudentMapper;
import com.cis.education.domain.EduCheckinStudent;
import com.cis.education.service.IEduCheckinStudentService;
import com.cis.common.core.text.Convert;

/**
 * 签到学生关系Service业务层处理
 * 
 * @author 管理员
 * @date 2022-02-10
 */
@Service
public class EduCheckinStudentServiceImpl implements IEduCheckinStudentService 
{
    @Autowired
    private EduCheckinStudentMapper eduCheckinStudentMapper;
    @Autowired
    private EduStudentMapper eduStudentMapper;

    /**
     * 查询签到学生关系
     * 
     * @param checkinId 签到学生关系主键
     * @return 签到学生关系
     */
    @Override
    public EduCheckinStudent selectEduCheckinStudentByCheckinId(Integer checkinId)
    {
        return eduCheckinStudentMapper.selectEduCheckinStudentByCheckinId(checkinId);
    }

    /**
     * 查询签到学生关系列表
     * 
     * @param eduCheckinStudent 签到学生关系
     * @return 签到学生关系
     */
    @Override
    public List<EduCheckinStudent> selectEduCheckinStudentList(EduCheckinStudent eduCheckinStudent)
    {

        List<EduCheckinStudent> eduCheckinStudents = eduCheckinStudentMapper.selectEduCheckinStudentList(eduCheckinStudent);

        //查询签到学生信息
        for (int i = 0; i < eduCheckinStudents.size(); i++) {
            EduStudent eduStudent = eduStudentMapper.selectEduStudentById(eduCheckinStudents.get(i).getStudentId());
            eduCheckinStudents.get(i).setEduStudent(eduStudent);
        }

        return eduCheckinStudents;
    }

    /**
     * 新增签到学生关系
     * 
     * @param eduCheckinStudent 签到学生关系
     * @return 结果
     */
    @Override
    public int insertEduCheckinStudent(EduCheckinStudent eduCheckinStudent)
    {
        return eduCheckinStudentMapper.insertEduCheckinStudent(eduCheckinStudent);
    }

    /**
     * 修改签到学生关系
     * 
     * @param eduCheckinStudent 签到学生关系
     * @return 结果
     */
    @Override
    public int updateEduCheckinStudent(EduCheckinStudent eduCheckinStudent)
    {
        return eduCheckinStudentMapper.updateEduCheckinStudent(eduCheckinStudent);
    }

    /**
     * 批量删除签到学生关系
     * 
     * @param checkinIds 需要删除的签到学生关系主键
     * @return 结果
     */
    @Override
    public int deleteEduCheckinStudentByCheckinIds(String checkinIds)
    {
        return eduCheckinStudentMapper.deleteEduCheckinStudentByCheckinIds(Convert.toStrArray(checkinIds));
    }

    /**
     * 删除签到学生关系信息
     * 
     * @param checkinId 签到学生关系主键
     * @return 结果
     */
    @Override
    public int deleteEduCheckinStudentByCheckinId(Integer checkinId)
    {
        return eduCheckinStudentMapper.deleteEduCheckinStudentByCheckinId(checkinId);
    }
}
